<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>保存产品成功管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#searchForm1").validate({
				submitHandler: function(form){
					if($("#tType").val()=="0"||$("input:checked").length<1){
						alertx("请选择产品类型/平台类型");
					}else{
						var str = $("#uploadFile").val();
						if(str.length==0){
							 alertx("请选择上传");
						}else{
							var point = str.lastIndexOf("."); 
						     var type = str.substr(point); 
						     if(type==".xls"||type==".xlsx"||type==".XLS"||type==".XLSX"){
						    	 loading('正在导入，请稍等...');
								 form.submit();
						     }else{
						    	 alertx("请导入“xls”或“xlsx”格式文件");
						     }
							
						}
					}
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/mid/goodInfo/">产品管理列表</a></li>
		<!--<shiro:hasPermission name="good:goodInfo:edit"><li><a href="${ctx}/mid/goodInfo/form">保存产品成功添加</a></li></shiro:hasPermission>-->
	</ul>

	<form:form id="searchForm" modelAttribute="goodInfo" action="${ctx}/mid/goodInfo/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li class="btns">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<form:form id="searchForm1" name='searchForm1' modelAttribute="goodInfo" action="${ctx}/mid/goodInfo/import" method="post" class="breadcrumb form-search" enctype="multipart/form-data" >
		<ul class="ul-form">
			<li><label>平台类型：</label>
			<form:checkboxes path="platformType" items="${fns:getDictList('sys_user_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
			</li>
			<li><label>产品类型：</label>
			<form:select path="tType"
				class="input-medium ">
				<form:option value="0" label="请选择" />
				<form:options items="${fns:getDictList('product_type')}"
					itemLabel="label" itemValue="value" htmlEscape="false" /></form:select>
			</li>
			<li>&nbsp;&nbsp;&nbsp;<input id="uploadFile" name="file" type="file" style="width:330px"/></li>
			<li class="btns">
			<input id="btnImport" class="btn btn-primary" type="submit" value="导入"/>
			<a href="">下载模板</a>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>产品品牌</th>
				<th>产品类型</th>
				<th>英文名称</th>
				<th>中文名</th>
				<th>更新时间</th>
				<shiro:hasPermission name="good:goodInfo:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="goodInfo">
			<tr>
				<td>
					${goodInfo.gProductBrand}
				</td>
				<td>
					${fns:getDictLabel(goodInfo.tType, "product_type", "")}
				</td>
				<td>
					${goodInfo.gEngDesc}
				</td>
				<td>
					${goodInfo.gChineseDesc}
				</td>
				<td>
					<fmt:formatDate value="${goodInfo.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<shiro:hasPermission name="good:goodInfo:edit"><td>
    				<a href="${ctx}/mid/goodInfo/form?goodInfoId=${goodInfo.goodInfoId}">修改</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>